-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
種々のリファクタリング等のまとめ #152
Merged
Merged
種々のリファクタリング等のまとめ #152
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention:
Additional details and impacted files
📢 Thoughts on this report? Let us know! |
e91f8cb
to
5dc0bb2
Compare
5dc0bb2
to
292d00e
Compare
272a0d8
to
6bf4059
Compare
6bf4059
to
63874e9
Compare
## 変更内容 ### 仮のTransformerで「とりあえず」の変換処理を行う - x-y 入れかえ処理を入れておく - これにともない GeoJSON, GeoPackage ドライバ内での x-y 入れかえは除去する - WGS 84 にしておく処理も追加 #155 ### Gpkg, GeoJSON 周りのリファクタリング - `nusamai-geojson` に "indexed" でないふつうのジオメトリをGeoJSON Valueに変換する関数を追加(tiling2d sink で使う)。 - #154 もこのPRにマージ - Gpkg のバイナリジオメトリの構築で、 `Vec<u8>` でなく `std::io::Write` trait を使う(`Vec<u8>`はWrite)。一時的なVecの生成も除去。 --- Closes: #125 Closes: #76
HashMap, IndexMap, etc. を多用する場面で、 Hasher を ahash に切り替える。 ### 背景 Rust の HashMap / HashSet はデフォルトで SipHash-1-3 (`std::hash::SipHash`) というハッシュ関数を使う。SipHashはHashDos攻撃への耐性が高いためにデフォルトのHasherとして採用されている。しかし高い HashDos 耐性が必要なく、hashを多用する場面ではより軽量なHasherに切り替えることができる(切り替えることがしばしば行われる)。 - [ahash](https://crates.io/crates/ahash) - それなりの HashDos 耐性があり、パフォーマンスもよい - [rust-lang/hashbrown](https://crates.io/crates/hashbrown) (Rustの現在のHashMap実装の元になった crate) のデフォルトのHasherは aHash なので、Hasherを切り替える代わりに、これを HashMap の置き換えとして使える。 - [fxhash](https://crates.io/crates/fxhash) - [rust-lang/rustc-hash](https://crates.io/crates/rustc-hash) - rustc で使われている Hasher
The Rust Performance Book によると、「hot iterators での Iterator::chain の使用は可能なら避けるとよい」とのことなので、除去しておく。 https://nnethercote.github.io/perf-book/iterators.html#chaining > [chain](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.chain) can be very convenient, but it can also be slower than a single iterator. It may be worth avoiding for hot iterators, if possible.
nokonoko1203
approved these changes
Jan 9, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Transformerやgeometry周り確認しつつ、動作確認もしました!
% time cd nusamai && cargo run --release -- ~/Downloads/plateau/22203_numazu-shi_2021_citygml_4_op/udx/bldg/*.gml --sink=gpkg --output=/Users/satoru/Downloads/output/output.gpkg
cargo run --release -- --sink=gpkg 11.10s user 4.44s system 358% cpu 4.334 total
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
変更内容
#153
仮のTransformerで「とりあえず」の全頂点の変換処理を行う
Gpkg, GeoJSON 周りのリファクタリング
nusamai-geojson
に "indexed" でないふつうのジオメトリをGeoJSON Valueに変換する関数を追加(tiling2d sink で使う)。Vec<u8>
でなくstd::io::Write
trait を使う(Vec<u8>
はWrite)。一時的なVecの生成も除去。:memory:
というファイルを作ってしまう)問題を修正その他
nusamai_citygml::object::Geometries
の名前をGeometryStore
に変更(ジオメトリのつめあわせであることを多少分かりやすく)GeometryStore
にCRSの情報をもたせられるようにしておく(仮)